{*<!--

+---------------------------------------------------------------------------+
| OpenX v${RELEASE_MAJOR_MINOR}                                                                |
| ======${RELEASE_MAJOR_MINOR_DOUBLE_UNDERLINE}                                                                 |
|                                                                           |
| Copyright (c) 2003-2009 OpenX Limited                                     |
| For contact details, see: http://www.openx.org/                           |
|                                                                           |
| This program is free software; you can redistribute it and/or modify      |
| it under the terms of the GNU General Public License as published by      |
| the Free Software Foundation; either version 2 of the License, or         |
| (at your option) any later version.                                       |
|                                                                           |
| This program is distributed in the hope that it will be useful,           |
| but WITHOUT ANY WARRANTY; without even the implied warranty of            |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             |
| GNU General Public License for more details.                              |
|                                                                           |
| You should have received a copy of the GNU General Public License         |
| along with this program; if not, write to the Free Software               |
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA |
+---------------------------------------------------------------------------+
$Id: market-campaigns-settings-list.html 54232 2010-06-01 20:07:44Z chris.nutting $

-->*}

{* AJAX response marker, do not remove *}
<!-- market-quickstart-campaigns -->

<input type="hidden" name="p" value="{$page|escape}" /> 
<input type="hidden" name="campaignType" value="{$campaignType|escape}" />
<input type="hidden" name="order" value="{$order|escape}" />
<input type="hidden" name="desc" value="{$desc|escape}" />
{if !empty($pager->links)}
    <input type="hidden" name="allSelected" value="{if $allSelected}true{/if}" id="allSelectedHidden" />
{/if}
 
{if !empty($topPager->links)}
  <div class="pager pager-top">
    <span class="controls">{$topPager->links}</span>
  </div>
{/if}
          
  
<div class="hide info-box" id="market-cpm-callout" style="height: auto; width: auto">
  {if $floorPriceColumnContextHelp}
    {$floorPriceColumnContextHelp}
  {else}
  <div style="width: 530px">
    <img src="{$aBranding.assetPath}/campaign-cpm-info.gif" alt="{$aBranding.name} competes with your campaigns to provide you with higher paying ads" />
    <h3>{t str="Opting in your campaigns to %s" values=$aBranding.name}</h3>
    <p>
      {t str="%s is a service that makes more money for you by holding real-time auctions for the impressions in your campaigns." values=$aBranding.name}
      {t str="When you opt in a campaign, %s will serve an ad only if it can pay higher than the floor price you assign, otherwise the campaign's original ad is served." values=$aBranding.name}
      {t str="By default, the floor price is set to the campaign's specified CPM or eCPM. If these are unavailable, a default floor price of %s USD is used." values=$defaultMinCpm}
    </p>
    <p><em>{t str="Tip:"}</em> {t str="To maximize revenue uplift, set a campaign's floor price close to the CPM it is already earning."}
    </p>
    <p class="faq-link">{t str="<a href='%s' target='_blank'>Learn more about %s</a>" values="`$aBranding.links.faq`|`$aBranding.name`"}</p>    
  </div>
  {/if}
</div>

<table cellspacing='0' summary=''>
  {if $campaigns|@count}
  <thead>
    <tr>
      <th class='first toggleAll'>
        <input type='checkbox' id="toggleAll"{if $allSelected} checked="checked"{/if} />
      </th>
      <th class="name{if $order == 'name'}{if $desc} sortDown{else} sortUp{/if}{/if}">
        <a href="market-campaigns-settings-list.php?order=name&amp;desc={if $order == 'name' && !$desc}1{else}0{/if}">{t str="Campaign"}</a>
      </th>
      
      <th class="mkt-status{if $order == 'optinstatus'}{if $desc} sortDown{else} sortUp{/if}{/if}">
        <a href="market-campaigns-settings-list.php?order=optinstatus&amp;desc={if $order == 'optinstatus' && !$desc}1{else}0{/if}">{t str="%s Settings" values=$aBranding.name}</a>
      </th>
      <th class='cpm last'>
        {t str="Floor Price (CPM)"}&nbsp;<span class="icon icon-info pointer" help="market-cpm-callout">&nbsp;</span>
      </th>
    </tr>
  </thead>
  {/if}
    
  {if !empty($pager->links)}
  <tbody id="selectAllContainer"{if !$allSelected} class="hide"{/if}>
    <tr class="header">
      <td colspan="4">
        <div id="selectAllCampaigns" class="selectAllInAccount hide">
          {t str="All <em>%s</em> campaigns on this page selected." values=$showingCount} <a href="#">{t str="Select all <em>%s</em> matching campaigns from this account" values=$allMatchingCount}</a>
        </div>
        <div id="allSelected" class="selectAllInAccount{if !$allSelected} hide{/if}">
          {t str="All <em>%s</em> matching campaigns from this account selected." values=$allMatchingCount} <a href="#">{t str="Clear selection"}</a>
        </div>
        {$selectAllExplanation}
      </td>
    </tr>
  </tbody>
  {/if}
  
  {if $campaigns|@count}
    <tbody>
      {cycle name=bgcolor values="even,odd" assign=bgColor reset=1}
      {foreach key=campaignId item=campaign from=$campaigns}
        {cycle name=bgcolor assign=bgColor}
        <tr class='{$bgColor}{if $selection[$campaignId]} selected{/if}'>
          <td class='toggleSelection'>
            <input type='checkbox' name="toOptIn[{$campaignId}]" value='1' 
                   id="c{$campaignId}"{if $selection[$campaignId]} checked="checked"{/if} />
          </td>
          <td>
            <span class="campaign-type-tag">{ox_campaign_type_tag type=$campaign.type}</span>
            {* Output escaped by boldSearchPhrase *}
            <label for="c{$campaignId}">{boldSearchPhrase text=$campaign.campaignname search=$search}</label>
          </td>
          
          <td>
             {if $campaign.optin_status}
             <span class="market-opted-in">{t str="Opted in"}</span>
             {else}
             <span class="market-not-opted">{t str="Not opted in"}</span>
             {/if} 
          </td>                
          <td>
            $ <input type="text" class="cpm{if $minCpmsInvalid[$campaignId]} error{/if}" maxlength="{$maxValueLength}" 
                     name="cpm{$campaignId}" id="cpm{$campaignId}" value="{$campaign.minCpm|escape}"  /> USD
            {if $minCpmsInvalid[$campaignId]}
              <label class="error" for="cpm{$campaignId}">
              {$minCpmsInvalid[$campaignId][1]}
              </label>
            {/if}
            <input type="hidden" disabled="disabled" 
                   value="{$campaign.minRecommendedFloorPrice|escape}" />
          </td>
        </tr>
      {/foreach}
    </tbody>
  {else}
    <tbody>
      <tr class='odd'>
        <td colspan='4'>&nbsp;</td>
      </tr>
      <tr class='even'>
        <td colspan='4' class="hasPanel">
          <div class='tableMessage'>
            <div class='panel'>
              {capture assign=typeString}
                {if $campaignType == 'remnant'}
                    {t str="remnant"}
                {elseif $campaignType == 'contract'}
                    {t str="contract"}
                {/if} 
              {/capture}
              {capture assign=searchString}
                {if $search}
                    with "{$search|escape}" in name
                {/if} 
              {/capture}
              
              {t str="There are no %s campaigns %s in your inventory" values="`$typeString`|`$searchString`"}

              <div class='corner top-left'></div>
              <div class='corner top-right'></div>
              <div class='corner bottom-left'></div>
              <div class='corner bottom-right'></div>
            </div>
          </div>

          &nbsp;
        </td>
      </tr>
      <tr class='odd'>
        <td colspan='4'>&nbsp;</td>
      </tr>
    </tbody>
{/if}
  <tbody class="tableFooter">
    <tr>
      <td colspan="4">
        <ul class='tableActions'>
          <li>
            <button class="left green-dot" type="submit" name="optInSubmit">
              <span>&nbsp;</span>
              {if $optInSubmitLabel}{$optInSubmitLabel}{else}{t str="Opt in to %s" values=$aBranding.name}{/if} 
            </button>
            <button class="left red-dot" type="submit" name="optOutSubmit">
              <span>&nbsp;</span>
              {if $optOutSubmitLabel}{$optOutSubmitLabel}{else}{t str="Opt out of %s" values=$aBranding.name}{/if} 
            </button>
          </li>
          {if $showSkipLink}
          <li><a href="{$adminWebPath}advertiser-index.php">{if $skipLinkLabel}{$skipLinkLabel}{else}{t str="Skip this step and do it later"} &raquo;{/if}</a></li>
          {/if}
        </ul>                  
        {if !empty($pager->links)}
        <div class="pager">
          <span class="summary">{$pager->summary}</span>
          <span class="controls">{$pager->links}</span>
        </div>
        {/if}
      </td>
    </tr>
  </tbody>
</table>
